import React, { useEffect, useState } from "react";

function getTimer(): Promise<string> {
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve(Date.now().toString());
    }, 5000);
  });
}
const useTimer = () => {
  const [loading, setLoading] = useState(true);
  const [info, setInfo] = useState("");

  useEffect(() => {
    getTimer().then(inf => {
      setLoading(false);
      setInfo(inf)
    })
  }, []);

  return {
    loading,
    info,
  };
};
export default useTimer;
